What is HAML-TO-PHP?
HAML-TO-PHP is a proprietary PHP implementation of the HAML language — a template system with an expressive, concise syntax. It is essentially a domain-specific language for writing HTML with dynamic content.
- HAML-to-PHP compiles
.hamlfiles to native.phpcode, offering maximum performance - Based on a minimalistic parser engine that prevents lock-in, especially when customizing HAML's syntax
- A library used in production
- See also: http://haml-lang.com (Ruby's HAML project)
Why Use HAML?
Advantages over HTML, Smarty, and plain PHP
- Proper HTML quoting and escaping — always, without exception
- Python-like indentation — tags close when indentation decreases, making HAML easy to read
- Less to type:
- CSS-like selectors such as
.class_nameor#id_valuedescribe adivelement - Write
%taginstead of<tag></tag>— opening and closing tags always match
- CSS-like selectors such as
- Easy enough that it can replace the need for WYSIWYG editors such as FCK
Side note: For new projects, using Ruby or a modern framework is also worth considering.
Differences to Ruby's HAML